package com.chen.service.menu;

import com.chen.dao.MenuMapper;
import com.chen.pojo.Menu;
import com.chen.vo.MenuVo;

import java.util.List;

public class MenuServiceImpl implements MenuService{
    //service调用dao层   整合dao进来
    private MenuMapper menuMapper;

    //set方法获得spring注入
    public void setMenuMapper(MenuMapper menuMapper) {
        this.menuMapper = menuMapper;
    }

    public List<Menu> queryAllMenu() {
        return menuMapper.queryAllMenu();
    }

    public List<Integer> findMenuIdListByRoleId(int roleId) {
        return menuMapper.findMenuIdListByRoleId(roleId);
    }

    public List<Menu> findMenuByMenuId(List<Integer> currentRoleMenuIds) {
        return menuMapper.findMenuByMenuId(currentRoleMenuIds);
    }

    public List<Menu> findMenuListByPage(MenuVo menuVo) {
        return menuMapper.findMenuListByPage(menuVo);
    }

    public int addMenu(Menu menu) {
        menu.setTarget("_self");
        return menuMapper.addMenu(menu);
    }

    public int updateMenu(Menu menu) {
        menu.setTarget("_self ");
        return menuMapper.updateMenu(menu);
    }

    public int getMenuCountByMenuId(Integer id) {
        return menuMapper.getMenuCountByMenuId(id);
    }

    public int deleteMenu(Integer id) {
        return menuMapper.deleteMenu(id);
    }

    public List<Menu> queryMenuListByEmployeeId(Integer vipId) {
        return menuMapper.queryMenuListByEmployeeId(vipId);
    }


}
